package top.csy8888.ch08.common.config;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.info.License;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import org.springframework.context.annotation.Configuration;

/**
 * @author CSY
 * @date 2025 - 09 - 17
 */
@Configuration
//使用注解配置OpenAPI的内容描述
@OpenAPIDefinition(
        //配置基本描述(title、版本、文档描述，以及开源授权等)
        info = @Info(
                title = "移动端接口文档",
                version = "1.0",
                description = "XXX商城移动端API接口",
                license = @License(name = "MIT",url = "http://mit.org")
        ),
        //所有需要JWT认证（token）,name属性引用下面@SecurityScheme注解的name值
        security = @SecurityRequirement(name = "JWT")
)
//设置JWT的认证模式
@SecurityScheme(
        name = "JWT",
        type = SecuritySchemeType.HTTP,
        scheme = "Bearer",
        in = SecuritySchemeIn.HEADER
)
public class OpenApiConfig {

}
